package com.google.code.maven_plugin_tutorial;

import java.util.List;

import org.apache.maven.model.Developer;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;

@Mojo(name = "print-developers")
public class PrintDeveloperMojo extends AbstractMojo {

	/**
	 * The Maven project.
	 */
	@Component
	private MavenProject project;

	@Override
	public void execute() throws MojoExecutionException, MojoFailureException {
		@SuppressWarnings("unchecked")
		List<Developer> developers = project.getDevelopers();

		for (Developer dev : developers) {
			getLog().info(dev.getId() + " " + dev.getName());
		}
	}
}
